package com.focusai.efairy.model.request;

import com.focusai.efairy.model.base.UpLoadBaseEntity;
import com.focusai.efairy.network.Response;
import com.focusai.efairy.network.exception.ParseException;
import com.focusai.efairy.network.request.base.PureJSONRequest;
import com.focusai.efairy.network.utils.UrlUtils;
import com.focusai.efairy.utils.GsonHelper;

import org.json.JSONException;

import java.util.List;
import java.util.Map;

/**
 * Created by lifeng on 2018/7/2.
 */

public class PostDeviceUpdateRequest extends PureJSONRequest<String> {

    private DeviceEntry deviceEntry;
    public PostDeviceUpdateRequest(DeviceEntry deviceEntry, Response.Listener<String> listener) {
        super(UrlUtils.createUrl("/appapi/device_update"), listener);
        this.deviceEntry = deviceEntry;
    }

    @Override
    protected String parse(String result) throws ParseException {
        return result;
    }

    @Override
    public Map<String, String> getParams() throws JSONException {
        return super.getParams();
    }

    @Override
    public String getPureJSON() throws JSONException {
        return GsonHelper.getInstance().toJson(deviceEntry);
    }

    public static class DeviceEntry extends UpLoadBaseEntity{
        public List<String> efairydevice_id_list;//设备编号列表（以后可以多选，目前只选择选中的列表）
        public String efairydevice_version;//当前版本（旧版本）
        public String dst_version;//升级到指定的版本
    }

}


